home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-13 | 18.1 KB | 708 lines | [TEXT/EDIT] |
- Only in /users/prof/colnet/SmallEiffel/lib_std: NEWcharacter_ref.e
- diff -r lib_std/array.e /users/prof/colnet/SmallEiffel/lib_std/array.e
- 9c9,12
- < inherit COLLECTION[E];
- ---
- > inherit
- > COLLECTION[E]
- > redefine eval_read_attribute, eval_write_attribute
- > end;
- 42c45
- < capacity := upper - lower + 1;
- ---
- > capacity := maxindex - minindex + 1;
- 44c47
- < capacity := capacity + 16;
- ---
- > if capacity < 16 then capacity := 16 end;
- 88,91c91
- < do
- < if storage = Void then end;
- < if lower = Void then end;
- < c_inline_c("R=(((C->_storage))[a1-(C->_lower)]);")
- ---
- > external "CSE"
- 97,101c97
- < -- Put `element' at position `index'.
- < do
- < if storage = Void then end;
- < if lower = Void then end;
- < c_inline_c("((C->_storage)[a2-(C->_lower)])=a1;");
- ---
- > external "CSE"
- 322a319,334
- > feature -- Interfacing with C :
- >
- > to_external: POINTER is
- > -- Gives C access into the internal `storage' of the ARRAY.
- > -- Result is pointing the element at index `lower'.
- > --
- > -- NOTE: do not free/realloc the Result. Resizing of the array
- > -- can makes this pointer invalid.
- > require
- > not empty
- > do
- > Result := storage;
- > ensure
- > Result.is_not_void
- > end;
- >
- 327a340,341
- > local
- > x: like item;
- 329c343
- < c_inline_c("R=malloc((size_t)(a1*sizeof(*(C->_storage))));");
- ---
- > c_inline_c("R=malloc((size_t)(a1*sizeof(_x)));");
- 334a349,350
- > local
- > x: like item;
- 336,337c352
- < c_inline_c("R=realloc(a1,%
- < %((size_t)(a2*sizeof(*(C->_storage)))));");
- ---
- > c_inline_c("R=realloc(a1,((size_t)(a2*sizeof(_x))));");
- 351a367,400
- > end;
- >
- > feature -- To implement eval :
- >
- > eval_read_attribute(name: STRING; dest: POINTER) is
- > do
- > if ("capacity").is_equal(name) then
- > eval_virtual_machine.put_integer(dest,capacity);
- > elseif ("lower").is_equal(name) then
- > eval_virtual_machine.put_integer(dest,lower);
- > elseif ("upper").is_equal(name) then
- > eval_virtual_machine.put_integer(dest,upper);
- > else
- > check
- > ("storage").is_equal(name)
- > end;
- > eval_virtual_machine.put_pointer(dest,storage);
- > end;
- > end;
- >
- > eval_write_attribute(name: STRING; source: POINTER) is
- > do
- > if ("capacity").is_equal(name) then
- > capacity := eval_virtual_machine.get_integer(source);
- > elseif ("lower").is_equal(name) then
- > lower := eval_virtual_machine.get_integer(source);
- > elseif ("upper").is_equal(name) then
- > upper := eval_virtual_machine.get_integer(source);
- > else
- > check
- > ("storage").is_equal(name)
- > end;
- > storage := eval_virtual_machine.get_pointer(source);
- > end;
- diff -r lib_std/array.e /users/prof/colnet/SmallEiffel/lib_std/array.elib_std/array2.e /users/prof/colnet/SmallEiffel/lib_std/array2.e
- 7,8c7,8
- < ANY
- < redefine copy, is_equal
- ---
- > ANY
- > redefine copy, is_equal, fill_tagged_out_memory
- 11,12c11
- < creation {ANY}
- < make, array2
- ---
- > creation make, array2
- 18c17
- < feature {ANY}
- ---
- > feature
- 77c76
- < feature {ANY}
- ---
- > feature
- 152c151
- < feature {ANY}
- ---
- > feature
- 271c270
- < lower2 = u2;
- ---
- > lower2 = l2;
- 330c329
- < feature {ANY} -- Other features :
- ---
- > feature -- Other features :
- 389a389,396
- > end;
- >
- > feature -- Object Printing :
- >
- > fill_tagged_out_memory is
- > do
- > tagged_out_memory.append("storage: ");
- > storage.out_in_tagged_out_memory;
- Only in /users/prof/colnet/SmallEiffel/lib_std: basic_ref.e
- diff -r lib_std/array2.e /users/prof/colnet/SmallEiffel/lib_std/array2.elib_std/boolean.e /users/prof/colnet/SmallEiffel/lib_std/boolean.e
- 13c13
- < prefix "not", to_string, to_integer
- ---
- > prefix "not", to_string, to_integer, fill_tagged_out_memory
- 84a85,91
- > end;
- >
- > feature -- Object Printing :
- >
- > fill_tagged_out_memory is
- > do
- > tagged_out_memory.append(to_string);
- diff -r lib_std/boolean.e /users/prof/colnet/SmallEiffel/lib_std/boolean.elib_std/character.e /users/prof/colnet/SmallEiffel/lib_std/character.e
- 12c12
- < code, to_lower, to_upper, print_on
- ---
- > code, to_lower, to_upper, fill_tagged_out_memory
- 146c146,148
- < print_on(file: STD_FILE_WRITE) is
- ---
- > feature -- Object Printing :
- >
- > fill_tagged_out_memory is
- 148,150c150,152
- < file.put_character('%'');
- < file.put_character(Current);
- < file.put_character('%'');
- ---
- > tagged_out_memory.extend('%'');
- > tagged_out_memory.extend(Current);
- > tagged_out_memory.extend('%'');
- diff -r lib_std/character.e /users/prof/colnet/SmallEiffel/lib_std/character.elib_std/character_ref.e /users/prof/colnet/SmallEiffel/lib_std/character_ref.e
- 6c6,9
- < inherit COMPARABLE redefine infix "<", compare end;
- ---
- > inherit
- > COMPARABLE
- > redefine infix "<", compare, fill_tagged_out_memory
- > end;
- 56a60,67
- > end;
- >
- > feature -- Object Printing :
- >
- > fill_tagged_out_memory is
- > do
- > tagged_out_memory.append("item: ");
- > item.fill_tagged_out_memory;
- diff -r lib_std/character_ref.e /users/prof/colnet/SmallEiffel/lib_std/character_ref.elib_std/collection.e /users/prof/colnet/SmallEiffel/lib_std/collection.e
- 58c58
- < first: E is
- ---
- > first: like item is
- 65c65
- < last: E is
- ---
- > last: like item is
- 74c74
- < put(element: E; index: INTEGER) is
- ---
- > put(element: like item; index: INTEGER) is
- 88,89c88
- < tmp: E;
- < -- *** WHAT ABOUT like item ?
- ---
- > tmp: like item;
- 99c98
- < set_all_with(v: E) is
- ---
- > set_all_with(v: like item) is
- 116c115
- < set_slice_with(v: E; lower_index, upper_index: INTEGER) is
- ---
- > set_slice_with(v: like item; lower_index, upper_index: INTEGER) is
- 140c139
- < value: E;
- ---
- > value: like item;
- 149c148
- < has(x: E): BOOLEAN is
- ---
- > has(x: like item): BOOLEAN is
- 155c154
- < fast_has(x: E): BOOLEAN is
- ---
- > fast_has(x: like item): BOOLEAN is
- 161c160
- < index_of(x: E): INTEGER is
- ---
- > index_of(x: like item): INTEGER is
- 178c177
- < fast_index_of(x: E): INTEGER is
- ---
- > fast_index_of(x: like item): INTEGER is
- 200c199
- < e1, e2: E;
- ---
- > e1, e2: like item;
- 221c220
- < value: E;
- ---
- > value: like item;
- 228c227
- < i > upper
- ---
- > not Result or else i > upper
- 231,235c230
- < if Result then
- < i := i + 1;
- < else
- < i := upper + 1;
- < end;
- ---
- > i := i + 1;
- 239c234
- < nb_occurrences(elt: E): INTEGER is
- ---
- > nb_occurrences(elt: like item): INTEGER is
- 260c255
- < fast_nb_occurrences(elt: E): INTEGER is
- ---
- > fast_nb_occurrences(elt: like item): INTEGER is
- 279c274
- < feature -- Printing :
- ---
- > feature -- Object Printing :
- 286c281
- < tagged_out_memory.append("lower = ");
- ---
- > tagged_out_memory.append("lower: ");
- 288c283
- < tagged_out_memory.append(" upper = ");
- ---
- > tagged_out_memory.append(" upper: ");
- 297,298c292,293
- < if v.is_expanded_type then
- < v.fill_tagged_out_memory;
- ---
- > if v = Void then
- > tagged_out_memory.append("Void");
- 300c295
- < v.fill_tagged_out_memory;
- ---
- > v.out_in_tagged_out_memory;
- 322c317
- < replace_all(x, r: E) is
- ---
- > replace_all(x, r: like item) is
- 338c333
- < fast_replace_all(x, r: E) is
- ---
- > fast_replace_all(x, r: like item) is
- 365c360
- < default_value: E;
- ---
- > default_value: like item;
- 393c388
- < equal_like(e1, e2: E): BOOLEAN is
- ---
- > equal_like(e1, e2: like item): BOOLEAN is
- 398,403c393,396
- < if e1.is_expanded_type then
- < Result := e1 = e2 or else e1.is_equal(e2);
- < -- *******
- < -- Problem with post-condition of ELKS standard_is_equal.
- < -- same_type is always false when receiver is an expanded
- < -- type.
- ---
- > if e1.is_basic_expanded_type then
- > Result := e1 = e2;
- > elseif e1.is_expanded_type then
- > Result := e1.is_equal(e2);
- diff -r lib_std/collection.e /users/prof/colnet/SmallEiffel/lib_std/collection.elib_std/comparable.e /users/prof/colnet/SmallEiffel/lib_std/comparable.e
- 10c10,14
- < inherit ANY redefine is_equal end;
- ---
- > inherit
- > ANY
- > redefine
- > is_equal
- > end;
- 12c16
- < feature {ANY}
- ---
- > feature
- diff -r lib_std/comparable.e /users/prof/colnet/SmallEiffel/lib_std/comparable.elib_std/double.e /users/prof/colnet/SmallEiffel/lib_std/double.e
- 13c13
- < compare, one, zero
- ---
- > compare, one, zero, fill_tagged_out_memory
- 221a222,228
- > feature -- Object Printing :
- >
- > fill_tagged_out_memory is
- > do
- > Current.append_in(tagged_out_memory);
- > end;
- >
- diff -r lib_std/double.e /users/prof/colnet/SmallEiffel/lib_std/double.elib_std/double_ref.e /users/prof/colnet/SmallEiffel/lib_std/double_ref.e
- 14c14
- < infix "<", compare
- ---
- > infix "<", compare, fill_tagged_out_memory
- 102a103,110
- > end;
- >
- > feature -- Object Printing :
- >
- > fill_tagged_out_memory is
- > do
- > tagged_out_memory.append("item: ");
- > item.fill_tagged_out_memory;
- diff -r lib_std/double_ref.e /users/prof/colnet/SmallEiffel/lib_std/double_ref.elib_std/fixed_array.e /users/prof/colnet/SmallEiffel/lib_std/fixed_array.e
- 42,43d41
- < local
- < model: like item;
- 46c44
- < storage := realloc(storage,size,model);
- ---
- > storage := realloc(storage,size);
- 48c46
- < storage := malloc(size,model);
- ---
- > storage := malloc(size);
- 79,81c77
- < do
- < if storage = Void then end;
- < c_inline_c("R=((C->_storage)[a1]);")
- ---
- > external "CSE"
- 87,88c83
- < do
- < c_inline_c("((C->_storage)[a2])=a1;");
- ---
- > external "CSE"
- 175a171,186
- > feature -- Interfacing with C :
- >
- > to_external: POINTER is
- > -- Gives C access into the internal `storage' of the ARRAY.
- > -- Result is pointing the element at index `lower'.
- > --
- > -- NOTE: do not free/realloc the Result. Resizing of the array
- > -- can makes this pointer invalid.
- > require
- > not empty
- > do
- > Result := storage;
- > ensure
- > Result.is_not_void
- > end;
- >
- 178c189
- < malloc(size: INTEGER; model: like item): POINTER is
- ---
- > malloc(size: INTEGER): POINTER is
- 180a192,193
- > local
- > x: like item;
- 182c195
- < c_inline_c("R=malloc((size_t)(a1*sizeof(a2)));");
- ---
- > c_inline_c("R=malloc((size_t)(a1*sizeof(_x)));");
- 185c198
- < realloc(pointer: POINTER; size: INTEGER; model: like item): POINTER is
- ---
- > realloc(pointer: POINTER; size: INTEGER): POINTER is
- 187a201,202
- > local
- > x: like item;
- 189c204
- < c_inline_c("R=realloc(a1,(size_t)(a2*sizeof(a3)));");
- ---
- > c_inline_c("R=realloc(a1,(size_t)(a2*sizeof(_x)));");
- diff -r lib_std/fixed_array.e /users/prof/colnet/SmallEiffel/lib_std/fixed_array.elib_std/general.e /users/prof/colnet/SmallEiffel/lib_std/general.e
- 166,167c166,167
- < -- When argument `other' is Void, call `twin' otherwise
- < -- return Void.
- ---
- > -- When argument `other' is Void, return Void
- > -- otherwise return `other.twin'.
- 190,191c190
- < c_inline_c("R=(T0 *)se_new(C->id);");
- < c_inline_c("AF_1");
- ---
- > c_inline_c("R=(T0 *)se_new(C->id);AF_1");
- 280c279
- < feature -- Output :
- ---
- > feature -- Input and Output :
- 309,316c308,310
- < out: STRING is
- < -- New string containing terse printable representation
- < -- of current object;
- < do
- < not_yet_implemented;
- < end;
- <
- < frozen print(some: GENERAL) is
- ---
- > feature -- Object Printing :
- >
- > print(some: GENERAL) is
- 318,321c312,316
- < -- `standard_output'. This routine is called to print
- < -- the stack when a `crash' occurs. Thus, user can redefine
- < -- `print_on' or `print_attributes_on' to adapt printing
- < -- of run time stack.
- ---
- > -- `standard_output'.
- > -- This routine is automatically called to print the stack
- > -- when system `crash'. As user can redefine `print',
- > -- `print_on' or `fill_tagged_out_memory', it is better to
- > -- be sure not to have a second `crash'.
- 331,333c326
- < -- Default printing for reference target.
- < --
- < -- Note : this routine is used to print stack when `crash'.
- ---
- > -- Default printing of current object.
- 335,346c328,329
- < file.put_string(generating_type);
- < file.put_character('#');
- < file.put_integer(object_id);
- < file.put_character('[');
- < print_attributes_on(file);
- < file.put_character(']');
- < end;
- <
- < print_attributes_on(file: STD_FILE_WRITE) is
- < do
- < tagged_out_memory.clear;
- < fill_tagged_out_memory;
- ---
- > tagged_out_memory.clear;
- > out_in_tagged_out_memory;
- 349c332
- <
- ---
- >
- 357c340
- < Result := clone(tagged_out_memory);
- ---
- > Result := tagged_out_memory.twin;
- 359a343,369
- > out: STRING is
- > -- Create a new string containing terse printable
- > -- representation of current object;
- > do
- > tagged_out_memory.clear;
- > out_in_tagged_out_memory;
- > Result := tagged_out_memory.twin;
- > end;
- >
- > out_in_tagged_out_memory is
- > -- Append terse printable represention of current object
- > -- in `tagged_out_memory';
- > do
- > if is_basic_expanded_type then
- > fill_tagged_out_memory;
- > else
- > tagged_out_memory.append(generating_type);
- > if not is_expanded_type then
- > tagged_out_memory.extend('#');
- > object_id.append_in(tagged_out_memory);
- > end;
- > tagged_out_memory.extend('[');
- > fill_tagged_out_memory;
- > tagged_out_memory.extend(']');
- > end;
- > end;
- >
- 365a376,377
- > -- Note : can be redefine to change printing of stack
- > -- when system crash.
- 482c494
- < crash is
- ---
- > frozen crash is
- 491c503
- < die_with_code(code:INTEGER) is
- ---
- > frozen die_with_code(code:INTEGER) is
- diff -r lib_std/general.e /users/prof/colnet/SmallEiffel/lib_std/general.elib_std/integer.e /users/prof/colnet/SmallEiffel/lib_std/integer.e
- 14c14
- < one, zero, print_on
- ---
- > one, zero, fill_tagged_out_memory
- 153,157d152
- < print_on(file: STD_FILE_WRITE) is
- < do
- < file.put_integer(Current);
- < end;
- <
- 300a296,302
- > feature -- Object Printing :
- >
- > fill_tagged_out_memory is
- > do
- > Current.append_in(tagged_out_memory);
- > end;
- >
- diff -r lib_std/integer.e /users/prof/colnet/SmallEiffel/lib_std/integer.elib_std/numeric.e /users/prof/colnet/SmallEiffel/lib_std/numeric.e
- 9c9,12
- < inherit ANY undefine is_equal end;
- ---
- > inherit
- > ANY
- > undefine is_equal
- > end;
- 11c14
- < feature {ANY}
- ---
- > feature
- 13c16
- < infix "+" (other : like Current) : like Current is
- ---
- > infix "+" (other: like Current): like Current is
- 20c23
- < infix "-" (other : like Current) : like Current is
- ---
- > infix "-" (other: like Current): like Current is
- 27c30
- < infix "*" (other : like Current) : like Current is
- ---
- > infix "*" (other: like Current): like Current is
- 42c45
- < infix "^" (exp : INTEGER) : like Current is
- ---
- > infix "^" (exp: INTEGER): like Current is
- 47,49c50,52
- < e : INTEGER;
- < product : like Current;
- < factor : like Current;
- ---
- > e : INTEGER;
- > product: like Current;
- > factor : like Current;
- 79c82
- < valid_divisor(other: like Current) : BOOLEAN is
- ---
- > valid_divisor(other: like Current): BOOLEAN is
- 86c89
- < one : like Current is
- ---
- > one: like Current is
- 90c93
- < neutral_element : -- Result is the neutral element of
- ---
- > neutral_element: -- Result is the neutral element of
- 98c101
- < neutral_element : -- Result is the neutral element of
- ---
- > neutral_element: -- Result is the neutral element of
- diff -r lib_std/numeric.e /users/prof/colnet/SmallEiffel/lib_std/numeric.elib_std/platform.e /users/prof/colnet/SmallEiffel/lib_std/platform.e
- 81c81
- < c_inline_c("R=(CHAR_BIT*sizeof(int));");
- ---
- > Result := Character_bits * (true).object_size;
- 98c98
- < c_inline_c("R=(CHAR_BIT*sizeof(int));");
- ---
- > Result := Character_bits * (1).object_size;
- 102c102
- <
- ---
- >
- 106c106
- < c_inline_c("R=(CHAR_BIT*sizeof(float));");
- ---
- > Result := Character_bits * (1.5).object_size;
- 115c115
- < c_inline_c("R=(CHAR_BIT*sizeof(double));");
- ---
- > Result := Character_bits * (1.5).to_double.object_size;
- 122a123,124
- > local
- > p: POINTER;
- 124c126
- < c_inline_c("R=(CHAR_BIT*sizeof(char *));");
- ---
- > Result := Character_bits * p.object_size;
- diff -r lib_std/platform.e /users/prof/colnet/SmallEiffel/lib_std/platform.elib_std/pointer.e /users/prof/colnet/SmallEiffel/lib_std/pointer.e
- 23c23
- < redefine print_on
- ---
- > redefine fill_tagged_out_memory
- 42c42,44
- < print_on(file: STD_FILE_WRITE) is
- ---
- > feature -- Object Printing :
- >
- > fill_tagged_out_memory is
- 44c46
- < file.put_string("POINTER");
- ---
- > tagged_out_memory.append("a POINTER");
- diff -r lib_std/pointer.e /users/prof/colnet/SmallEiffel/lib_std/pointer.elib_std/real.e /users/prof/colnet/SmallEiffel/lib_std/real.e
- 14c14
- < zero, print_on
- ---
- > zero, fill_tagged_out_memory
- 187c187,189
- < print_on(file: STD_FILE_WRITE) is
- ---
- > feature -- Object Printing :
- >
- > fill_tagged_out_memory is
- 189c191
- < file.put_real(Current);
- ---
- > Current.append_in(tagged_out_memory);
- 191c193
- <
- ---
- >
- diff -r lib_std/real.e /users/prof/colnet/SmallEiffel/lib_std/real.elib_std/std_file.e /users/prof/colnet/SmallEiffel/lib_std/std_file.e
- 83a84,87
- > fflush(stream_pointer: POINTER): INTEGER is
- > external "C"
- > end;
- >
- diff -r lib_std/std_file.e /users/prof/colnet/SmallEiffel/lib_std/std_file.elib_std/std_file_read_write.e /users/prof/colnet/SmallEiffel/lib_std/std_file_read_write.e
- 63,68d62
- < feature {NONE}
- <
- < fflush(stream_pointer : POINTER): INTEGER is
- < external "C"
- < end;
- <
- diff -r lib_std/std_file_read_write.e /users/prof/colnet/SmallEiffel/lib_std/std_file_read_write.elib_std/string.e /users/prof/colnet/SmallEiffel/lib_std/string.e
- 13,14c13,14
- < print_on, fill_tagged_out_memory, eval_read_attribute,
- < eval_write_attribute
- ---
- > out_in_tagged_out_memory, fill_tagged_out_memory,
- > eval_read_attribute, eval_write_attribute
- 821c821
- < print_on(file: STD_FILE_WRITE) is
- ---
- > out_in_tagged_out_memory is
- 823,825c823,825
- < tagged_out_memory.clear;
- < fill_tagged_out_memory;
- < file.put_string(tagged_out_memory);
- ---
- > tagged_out_memory.extend('%"');
- > tagged_out_memory.append(Current);
- > tagged_out_memory.extend('%"');
- 830c830,834
- < tagged_out_memory.extend('%"');
- ---
- > tagged_out_memory.append("count: ");
- > count.append_in(tagged_out_memory);
- > tagged_out_memory.append("capacity: ");
- > capacity.append_in(tagged_out_memory);
- > tagged_out_memory.append("storage: %"");
- 950c954
- < remove_last(1);
- ---
- > count := count - 1;
- 1006c1010
- < feature
- ---
- > feature -- To implement eval :
-